package exp;

import org.quartz.*;

import java.text.SimpleDateFormat;
import java.util.Date;

public class HelloJob implements Job {

    private String message;

    private float floatMsg;

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public float getFloatMsg() {
        return floatMsg;
    }

    public void setFloatMsg(float floatMsg) {
        this.floatMsg = floatMsg;
    }

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        System.out.println("-----------------------------------------------");
        System.out.println("Hello Job World");
        System.out.println(new SimpleDateFormat("yyyy/mm/dd HH:ss:mm").format(new Date()));

        JobKey key = context.getJobDetail().getKey();
        System.out.println("Job name + group" + key.getName() + key.getGroup());

        TriggerKey key1 = context.getTrigger().getKey();
        System.out.println("Trigger name + group" + key1.getName() + key.getGroup());

        JobDataMap dataMap = context.getMergedJobDataMap();
        //JobDataMap map = context.getJobDetail().getJobDataMap();
        //System.out.println(dataMap.getString("message"));
        //System.out.println(dataMap.getFloatFromString("floatMessage"));

        //JobDataMap jobDataMap = context.getTrigger().getJobDataMap();
        //System.out.println(dataMap.getString("helloMyTrigger"));

        ///System.out.println(message);
        //System.out.println(floatMsg);

        Date endTime = context.getTrigger().getEndTime();
        Date startTime = context.getTrigger().getStartTime();
        System.out.println(endTime.getTime());
        System.out.println(startTime.getTime());

    }
}
